//引入字体图标样式
require("../../assets/fonts/iconfont.css");
//引入axios
const axios = require("../../assets/js/axios.js");
//引入自定义js
let obj = require("../../assets/js/my.js");
let $ = obj.$;
let local = obj.local;
let addTabs = obj.addTabs;
//移入页面的css样式
require("./circle_vicinity.less");
document.addEventListener("DOMContentLoaded", async function () {
	addTabs("circle");
	// 1.发送请求渲染
	let province = await axios.get("api/shared/province");
	let pro = province.data.data;
	// console.log(pro);
	//2.跳转
	$("#tianjia").addEventListener("click", function () {
		location.href = "add_dynamics.html";
	});
	//3.渲染
	axios.get("/api/circles/opinionList").then((res) => {
		let data = res.data.data;
		data.forEach(async (v) => {
			let Pro = pro.find((vi) => vi.id === v.releaseProvinceId);
			let city = await axios.get("/api/shared/city?provinceId=" + Pro.id);
			let cit = city.data.data.filter((vi) => vi.id === v.releaseCityId);
			$("#dynamicList").innerHTML += ` <li class="use">
			<div class="use_title">
				<div class="portrait">

				</div>
				<div class="usename">
					<p>用户名</p>
					<p><span>${Pro.name}</span> <span>${cit[0].name}</span></p>
				</div>
				<p class="attention">
					<span class="iconfont icon-jiahao"></span>关注
				</p>
			</div>
			<p class="content" id="content">${v.content}</p>
		</li>`;
		});
	});
});
